package com.ruoyi.web.controller.applet;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.dto.UserCollectBto;
import com.ruoyi.system.service.IBdmUserCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 小程序收藏Controller
 * 
 * @author ruoyi
 * @date 2024-12-12
 */
@RestController
@RequestMapping("/applet/collect")
public class AppletCollectController extends BaseController
{
    @Autowired
    private IBdmUserCollectService bdmUserCollectService;

    /**
     * 查询收藏列表
     */
    @GetMapping("/appletCollectList")
    public AjaxResult appletCollectList(UserCollectBto userCollectBto)
    {
        return success(bdmUserCollectService.appletBdmUserCollectList(userCollectBto));
    }

    /**
     * 获取收藏详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(bdmUserCollectService.selectBdmUserCollectById(id));
    }

    /**
     * 收藏
     * @param userCollectBto
     * @return
     */
    @Log(title = "小程序收藏", businessType = BusinessType.INSERT)
    @PostMapping("/saveCollect")
    public AjaxResult saveCollect(@RequestBody UserCollectBto userCollectBto)
    {
        return toAjax(bdmUserCollectService.saveCollect(userCollectBto));
    }
}
